import { fromJS } from 'immutable'
import * as constant from './constant'
const defaultState = fromJS({
  wrapData: [],
  page: 1
})
export default ((state= defaultState, action) => {
    switch ( action.type ){
        case constant.GET_WRAP_DATA:
        return state.merge({
            wrapData: fromJS(action.wrapData)
        })
        case constant.ADD_MORE_DATA:
        return state.merge({
            wrapData: state.get('wrapData').concat(action.list),
            page: action.nextPage
        })
        default:
        return state;
    }
 })